home *** CD-ROM | disk | FTP | other *** search
/ Clinical Endocrinology / Clinical Endocrinology.iso / mac / 00000000 / 06000000 / Shared.dir / 00955_Script_doCapture < prev    next >
Text File  |  1995-11-17  |  2KB  |  93 lines

  1. -- Code for Capturing Screen
  2.  
  3. on DoCapture
  4.   global hardDisk
  5.   
  6.   if voidP(slidesLocation) = true then
  7.     set slidesLocation = "Endocrinology:Desktop Folder:"
  8.   end if
  9.   
  10.   -- Open Capture XLib file
  11.   if the machineType <> 256 then
  12.     openXLib hardDisk &"CaptureXObj"
  13.   else
  14.     openxlib hardDisk & "Capture.dll"
  15.   end if
  16.   
  17.   
  18.   -- Define Rectangle boundaries for capture
  19.   set top = the top of sprite 5
  20.   set left = the left of sprite 5
  21.   set bottom = the bottom of sprite 5
  22.   set right = the right of sprite 5
  23.   
  24.   
  25.   
  26.   -- Create instance of capture object
  27.   set grab = Capture(mNew, top, left, bottom, right)
  28.   
  29.   -- Prompt user for filename
  30.   if the machineType <> 256 then
  31.     -- Mac filenames
  32.     set default = "Capture.Pict"
  33.   else
  34.     set default = "CAPTURE.BMP"
  35.   end if
  36.   set file = FileIO(mNew, "?write", default)
  37.   if ObjectP(file) then
  38.     set captureFile = file(mFilename)
  39.     file(mDelete)
  40.   else
  41.     set captureFile = ""
  42.     -- alert "FileIO Error:"&&String(file)
  43.   end if
  44.   
  45.   -- Hide all irrelevant graphics first
  46.   repeat with i = 6 to 35
  47.     set the visible of sprite i = FALSE
  48.   end repeat
  49.   repeat with i = 38 to 48
  50.     set the visible of sprite i = FALSE
  51.   end repeat
  52.   
  53.   updateStage -- Refresh screen under dialog, erase button
  54.   
  55.   
  56.   -- Capture to specified file
  57.   if captureFile <> "" then
  58.     grab(mSave, captureFile)
  59.   end if
  60.   
  61.   -- Restore graphics
  62.   repeat with i = 6 to 35
  63.     set the visible of sprite i = TRUE
  64.   end repeat
  65.   repeat with i = 38 to 48
  66.     set the visible of sprite i = TRUE
  67.   end repeat
  68.   updateStage -- Refresh button
  69.   
  70.   grab(mDispose)
  71.   
  72.   -- Close Capture XLib file
  73.   if the machineType <> 256 then
  74.     closexlib hardDisk &"CaptureXObj"
  75.   else
  76.     closexlib hardDisk & "Capture.dll"
  77.   end if
  78.   
  79. end DoCapture
  80. -----------------------------------------------------------
  81. -- Handler to open MIAW for user input for slide
  82. -- capture.
  83.  
  84. on openCapturePrompt
  85.   
  86.   global hardDisk
  87.   
  88.   put hardDisk & "Slideslog.dir" into childWindow
  89.   set the title of window childWindow to "Save Slide"
  90.   open window childWindow
  91.   
  92. end openCapturePrompt
  93.